﻿using mqtt.client.test.Mqtt;
using mqtt.client.test.Mqtt.Connect;
using mqtt.client.test.Mqtt.Constant;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XjjXmm.Infrastructure.Common;
using XjjXmm.Infrastructure.Exceptions;

namespace mqtt.client.test.Output;

internal class PublishAckOutput
{
    private readonly ArraySegment<byte> _buffer;

    public PublishAckOutput(ArraySegment<byte> buffer)
    {
        _buffer = buffer;
    }

    public Response<int> Result()
    {
        // Get the return code from the buffer
        var msb = _buffer[2];
        var lsb = _buffer[3];

        // Switch on the return code

        return new Response<int>(msb << 8 | lsb);

    }


}
